package com.yisoo.ubag.app.feign;

import com.yisoo.common.to.CheckDeviceIsOpenTo;
import com.yisoo.common.to.RefreshBagStatusTo;
import com.yisoo.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@FeignClient("ubag-iot")
public interface IotFeignService {

    @RequestMapping("/iot/feign/check/{devsecret}")
    CheckDeviceIsOpenTo check(@PathVariable("devsecret") String  devSecret);

    @GetMapping("/iot/feign/open/{bagId}")
    R open(@PathVariable("bagId") String  bagId);

    @GetMapping("/iot/feign/close/{bagId}")
    R close(@PathVariable("bagId") String  bagId);


    @GetMapping("/iot/feign/get/bag/status/{bagId}")
    R getBagStatus(@PathVariable("bagId") String  bagId);

    @GetMapping("/iot/feign/update/bag/status/{bagId}/{data}")
    R updateBagStatus(@PathVariable("bagId")Long bagId, @PathVariable("data")Integer data);


    @GetMapping("/iot/feign/get/bag/up/data/{bagId}")
    RefreshBagStatusTo getBagStatusData(@PathVariable("bagId")Long bagId);


    @GetMapping("/iot/feign/test/mapping/{bagId}/{control}")
    R testMapping(@PathVariable("bagId")Long bagId, @PathVariable("control")Integer control);
    @GetMapping("/iot/feign/lock/bag/{devcode}/{bagId}")
    R lock(@PathVariable("devcode")String devcode, @PathVariable("bagId")Long bagId);
//    //仅供测试
//    @GetMapping("/iot/device/open/box/test/{devsecret}")
//    R openBoxTest(@PathVariable("devsecret") String  devSecret);

}
